<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>文档</title>
  <link href="../css/semantic/semantic.min.css" rel="stylesheet">
  <link href="../css/markdown.css" rel="stylesheet">
    <link href="../css/wtxynavigation.css" rel="stylesheet">
    <script src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/include.js"></script>
  <style>
    body{padding-top:0;background:#f7f7f7}
    body>.ui.container{width:100%;padding:0}
    #project-title{background:#6e6e6e;width:100%;line-height:3.572rem;color:#fff;font-size:1.2rem}
    #project-title .title-wrap{font-weight:700;padding:0 12px;width:100%;max-width:1366px!important;min-width:900px;margin:0 auto}
    #project-title .left,#project-title right{display:inline-block}
    #project-title .right{float:right}
    #project-title .right .wiki-actions .menu{left:auto;right:0;margin-top:.4em!important}
    #wiki-preview-container{width:100%;max-width:1366px!important;min-width:900px;padding:0;border:1px solid #e3e9ed;border-top:0}
    #wiki-preview>.ui.segment{margin-top:0;padding:1rem;padding-left:0;border:0}
    .hover-places{display:inline-block}
    #page-detail{width:60%;margin:0 auto}
    #page-detail .title{font-weight:700;font-size:24px;padding:12px 0;border-bottom:1px solid #ccc}
    #page-detail .content{margin-top:15px}
    .content p{word-wrap:break-word}
    #wiki-parent,#wiki-title,#wikis{display:none}
    .ui.grid{padding:0!important}
    #ex-all{cursor:pointer;color:#537c8d}
  </style>
</head>
<body>
  <div class="ui container">

      <div id="wtxyNav"></div>

    <div class="ui container" id="wiki-preview-container">
      <div id="wiki-preview">
        <div class="ui segment">
          <div id="page-detail" class="markdown-body">
            <div class='title'>13.GCD同步全局队列问题</div><div class='content'><h1>
<a id="13gcd同步全局队列问题" class="anchor" href="#13gcd%E5%90%8C%E6%AD%A5%E5%85%A8%E5%B1%80%E9%98%9F%E5%88%97%E9%97%AE%E9%A2%98"></a>13.GCD同步全局队列问题</h1>
<h1>
<a id="下面打印是什么结果" class="anchor" href="#%E4%B8%8B%E9%9D%A2%E6%89%93%E5%8D%B0%E6%98%AF%E4%BB%80%E4%B9%88%E7%BB%93%E6%9E%9C"></a>下面打印是什么结果</h1>
<pre><code>- (void)viewDidLoad
{
    [super viewDidLoad];
    
    
    NSLog(@"1");
    NSLog(@"%@", [NSThread currentThread]);
    dispatch_sync(dispatch_get_global_queue(0, 0), ^{
        
        
        NSLog(@"2");
        NSLog(@"%@", [NSThread currentThread]);
        dispatch_sync(dispatch_get_global_queue(0, 0), ^{
            
           
            
            NSLog(@"3");
            NSLog(@"%@", [NSThread currentThread]);
        });
        
        NSLog(@"4");
        NSLog(@"%@", [NSThread currentThread]);
        
    });
    
    NSLog(@"5");
    NSLog(@"%@", [NSThread currentThread]);
    
}


</code></pre>
<pre><code>
2021-05-09 21:09:34.137424+0800 UIViewTransformPoint[3354:6284638] 1
2021-05-09 21:09:34.137619+0800 UIViewTransformPoint[3354:6284638] &lt;NSThread: 0x600003418180&gt;{number = 1, name = main}
2021-05-09 21:09:34.137745+0800 UIViewTransformPoint[3354:6284638] 2
2021-05-09 21:09:34.137900+0800 UIViewTransformPoint[3354:6284638] &lt;NSThread: 0x600003418180&gt;{number = 1, name = main}
2021-05-09 21:09:34.137999+0800 UIViewTransformPoint[3354:6284638] 3
2021-05-09 21:09:34.138132+0800 UIViewTransformPoint[3354:6284638] &lt;NSThread: 0x600003418180&gt;{number = 1, name = main}
2021-05-09 21:09:34.138243+0800 UIViewTransformPoint[3354:6284638] 4
2021-05-09 21:09:34.138367+0800 UIViewTransformPoint[3354:6284638] &lt;NSThread: 0x600003418180&gt;{number = 1, name = main}
2021-05-09 21:09:34.138487+0800 UIViewTransformPoint[3354:6284638] 5
2021-05-09 21:09:34.138621+0800 UIViewTransformPoint[3354:6284638] &lt;NSThread: 0x600003418180&gt;{number = 1, name = main}



</code></pre>
<h2>
<a id="描述" class="anchor" href="#%E6%8F%8F%E8%BF%B0"></a>描述</h2>
<h3>
<a id="1" class="anchor" href="#1"></a>1.</h3>
<h1>
<a id="答--12345" class="anchor" href="#%E7%AD%94--12345"></a>答:  12345</h1>
<ul>
<li>
<ol>
<li>同步任务在<strong>当前线程</strong>执行, 不开启新线程</li>
</ol>
</li>
</ul></div>
          </div>
        </div>
      </div>
      </div>
  </div>
</body>
</html>